package com.example.testinterface.login;


import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.testinterface.R;
import com.example.testinterface.mvp.MVPBaseActivity;
import com.lsjr.callback.StringCallBack;
import com.lsjr.utils.HttpUtils;

import java.util.HashMap;

import butterknife.BindView;
import itbour.onetouchshow.utils.UIUtils;


/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class LoginActivity extends MVPBaseActivity<LoginContract.View, LoginPresenter> implements LoginContract.View {

    @BindView(R.id.id_getData)
    Button button;
    public void getData(){
        HashMap<String, String> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("device", 2 + "");
        stringStringHashMap.put("uuid", "EEBAF7D1EC6914A914CE95209D6BFDBB-Android");
        stringStringHashMap.put("type", 1 + "");
        //用于获取服务器通知例如服务器维护等 已加密
        String NOTIFICATON = "/v5/tg3/getMainPage_v6_3";
        //加密请求地址

        //HashMap requestParams = Encrypt.transEncrytionParams(stringStringHashMap, NOTIFICATON);
        HttpUtils.getInstance().getServiceData(NOTIFICATON,stringStringHashMap , new StringCallBack() {
            @Override
            protected void onXError(String exception) {

            }

            @Override
            protected void onSuccess(String response) {

            }
        });

    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void afterCreate(Bundle savedInstanceState) {
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getData();
            }
        });


        UIUtils.getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
               // showProgressDialogWithText("加载中");
            }
        },2000);

        UIUtils.getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                showLoadingView();
            }
        },6000);


        UIUtils.getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                showErrorView();
            }
        },9000);


        UIUtils.getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                showContentView();
            }
        },12000);


    }


}
